<?php
class editAction extends rareAction{
	public function	execute(){
		$id = $this->getGetParam('id',0);
		if($id==0||$id==1) forward('manager');
		$dao = new DaoAdmin();
		$user = $dao->getOne(" id='{$id}'");
		$this->assign('user',$user);
	}
	public function executePost(){
		$id = $this->getPostParam('id',0);
		if($id==0||$id==1) jsonReturn(0,'参数错误');
		$passwd1 = $this->getPostParam('passwd1','');
		$passwd2 = $this->getPostParam('passwd2','');
		if($passwd1==$passwd2&&$passwd1!=''&&$passwd2!=''){
			$dao = new DaoAdmin();
			$dao->update(" id='{$id}'",array('passwd'=>md5($passwd1)));
			jsonReturn(1,'ok');
		}
		jsonReturn(0,'重新输入密码');
	}
}
?>
